    /*********************************************************************************************************/
   /* Foreign Borrowing, Sovereignty, and Public Opinion in the Global South: Traditional Lenders or China? */
  /*********************************************************************************************************/
 /******************************* David Bulman, Ning Leng, and Kerry Ratigan ******************************/
/*********************************************************************************************************/

/* 
This is the replication file for "Foreign Borrowing, Sovereignty, and Public Opinion in the Global South: Traditional Lenders or China?"

The file creates the conjoint analysis tables and figures used in the article.  This includes:
	- Main text:
	--- Figure 2. Conjoint experiment results, pooled sample 
	--- Figure 3. Conjoint results conditioned on past economic harm from IFI loans 
	--- Figure 4. Interaction of creditor and loan characteristics on foreign loan preferences 
	- Supplementary materials:
	--- Figure E1. Conjoint experiment results, marginal means, pooled sample 
	--- Figure E2. Conjoint experiment results, by region (pooled) 
	--- Figure E3. Conjoint experiment results, by country 
	--- Figure E5a. Conjoint results, conditional on whether respondents believe that lending from the Chinese government has caused past economic harm 
	--- Figure E5b. Conjoint results, conditional on whether respondents believe that lending from the US government has caused past economic harm 
	--- Figure E5c. Conjoint results, conditional on whether respondents believe that lending from private commercial banks has caused past economic harm 
	--- Figure E6. Interaction of creditor and loan characteristics on foreign loan preferences, marginal means 
	--- Figure E7. Conjoint results, conditioned on agreement that the IMF is controlled by the US 
	--- Figure F3. Estimated AMCEs, conditioned on sovereignty threat perception 
	--- Figure F7. Estimated AMCEs, conditioned by associating China with "debt trap diplomacy" 
	
The file uses the following datasets:
	--- ForeignBorrowingPublicOpinion_BailoutLoan.dta (created using ForeignBorrowingPublicOpinion_BailoutLoanCleaning.do)
	--- ForeignBorrowingPublicOpinion_ProjectLoan.dta (created using ForeignBorrowingPublicOpinion_ProjectLoanCleaning.do)
	--- ForeignBorrowingPublicOpinion_ConjointMerged.dta (merged data from the two preceding files) 

Other descriptive tables and figures in the main text and supplementary materials are based on summaries of data from this baseline dataset:
	--- ForeignBorrowingPublicOpinion_CleanData.dta
*/

/* Set directory */
cd "C:\Users\dbulman1\Dropbox\Work in progress\Global China Perceptions Survey\Debt\Data and analysis"


/* CONJOINT ANALYSIS */


/* Figure 2. Conjoint experiment results, pooled sample */

use ForeignBorrowingPublicOpinion_ConjointMerged.dta, clear

quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1, cluster(responseid) 
	estimates store baseline_project
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1, cluster(responseid) 
	estimates store baseline_bailout

coefplot (baseline_project, label(Project Loan) mcolor(black) ciopts(lcolor(black))) ///
		(baseline_bailout, label(Bailout Loan) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))) ///
		, baselevels drop(_cons) xline(0) legend(rows(1) position(6)) ///
		msize(small) xtitle("Estimated AMCEs", size(small)) xlabel(, labsize(small)) ylabel(, labcolor(gs5) labsize(small)) ///
		headings(1.att_lender="{bf:Lender}" ///
			1.att_purpose="{bf:Purpose}" ///
			1.att_collateral="{bf:Collateral}" ///
			1.att_condition="{bf:Conditionality}" ///
			1.att_intrate="{bf:Interest rate}", ///
			labcolor(black) labsize(small))
		graph save Charts\Figure2.gph, replace 

		
/* Figure 3. Conjoint results conditioned on past economic harm from IFI loans */

quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & debt_harm_imf==0, cluster(responseid) 
	estimates store project_noharm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & debt_harm_imf==1, cluster(responseid) 
	estimates store project_harm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & debt_harm_imf==0, cluster(responseid) 
	estimates store bailout_noharm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & debt_harm_imf==1, cluster(responseid) 
	estimates store bailout_harm
	
coefplot (project_noharm, label(No Harm (IFI)) mcolor(black) ciopts(lcolor(black))) ///
		(project_harm, label(Past Harm (IFI)) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Project Loan") || ///
		(bailout_noharm, label(No Harm (IFI)) mcolor(black) ciopts(lcolor(black))) ///
		(bailout_harm, label(Past Harm (IFI)) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Bailout Loan") ||, ///
		baselevels drop(_cons) xline(0) ///
		msize(small) xtitle("Estimated AMCEs", size(small)) xlabel(, labsize(small)) ylabel(, labcolor(gs5) labsize(small)) ///
		headings(1.att_lender="{bf:Lender}" ///
			1.att_purpose="{bf:Purpose}" ///
			1.att_collateral="{bf:Collateral}" ///
			1.att_condition="{bf:Conditionality}" ///
			1.att_intrate="{bf:Interest rate}", ///
			labcolor(black) labsize(small)) ///
			legend(position(bottom))			
			graph save Charts\Figure3.gph, replace

			
/* Figure 4. Interaction of creditor and loan characteristics on foreign loan preferences */

gen lender_ifi=att_lender==1
gen lender_chn=att_lender==2

quietly reg selected i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & lender_ifi==1, cluster(responseid) 
	estimates store int0_project
quietly reg selected i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & lender_chn==1, cluster(responseid) 
	estimates store int1_project
quietly reg selected i.att_collateral i.att_condition i.att_intrate if bailconj==1 & lender_ifi==1, cluster(responseid) 
	estimates store int0_bailout
quietly reg selected i.att_collateral i.att_condition i.att_intrate if bailconj==1 & lender_chn==1, cluster(responseid) 
	estimates store int1_bailout
	
coefplot (int0_project, label(IFI) mcolor(black) ciopts(lcolor(black))) ///
		(int1_project, label(China) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Project Loan") || ///
		(int0_bailout, label(IFI) mcolor(black) ciopts(lcolor(black))) ///
		(int1_bailout, label(China) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Bailout Loan") ||, ///
		baselevels drop(_cons) xline(0) ///
		msize(small) xtitle("Estimated AMCEs", size(small)) xlabel(, labsize(small)) ylabel(, labcolor(gs5) labsize(small)) ///
		headings(1.att_lender="{bf:Lender}" ///
			1.att_purpose="{bf:Purpose}" ///
			1.att_collateral="{bf:Collateral}" ///
			1.att_condition="{bf:Conditionality}" ///
			1.att_intrate="{bf:Interest rate}", ///
			labcolor(black) labsize(small)) ///
			legend(position(bottom))			
			graph save Charts\Figure4.gph, replace

		
		
/* SUPPLEMENTARY ANALYSIS */

	
/* Figure E1. Conjoint experiment results, marginal means, pooled sample */

use ForeignBorrowingPublicOpinion_ProjectLoan.dta, clear
conjoint selected att_lender att_collateral att_condition att_intrate att_purpose, est(mm) id(responseid) 
	matrix project_mm=e(results)
use ForeignBorrowingPublicOpinion_BailoutLoan.dta, clear
conjoint selected att_lender att_collateral att_condition att_intrate, est(mm) id(responseid) 
	matrix bailout_mm=e(results)

coefplot (matrix(project_mm[,1]), label(Project Loan) mcolor(black) ciopts(lcolor(black))) ///
		(matrix(bailout_mm[,1]), label(Bailout Loan) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), ///
		ci((5 6)) keep(*:) order(World_Bank IMF Chinese_government US_government Private_banks) xline(0.5, lpattern(-) lcolor(black)) ///
		coeflabels( World_Bank= "World Bank" IMF="IMF"  Chinese_government= "Chinese government"  US_government= "US government"  Private_banks= "Private banks" ///
		Nothing= "Nothing"  Land= "Land"  Resources= "Resources"  None="None"  Austerity= "Austerity"  Transparency= "Transparency"  Labor_and_materials= "Labor and materials"  ///
		_2_= "2%"  _6_= "6%"  _10_= "10%"  Highway_network= "Highway network"  _5G_network= "5G network") ///		
		eqlabels( "{bf:Lender}" "{bf:Collateral}" "{bf:Conditionality}" "{bf:Interest Rate}" "{bf:Purpose}", asheadings) graphregion(col(white)) scale(0.7) xtitle({bf:Estimated MMs}) ///
		legend(position(bottom))	
		graph save Charts\FigureE1.gph, replace 

		
/* Figure E2. Conjoint experiment results, by region (pooled) */		
		
use ForeignBorrowingPublicOpinion_ConjointMerged.dta, clear

gen region=1 if country=="Kenya" | country=="Nigeria" | country=="SouthAfrica"
	replace region=2 if country=="Argentina" | country=="Colombia" | country=="Peru" 
	replace region=3 if country=="Indonesia" | country=="Malaysia" | country=="Philippines"
		label define region_labels 1 "Sub-Saharan Africa" 2 "South America" 3 "Southeast Asia" 
		label values region region_labels	

forvalues i=1/3 {
	quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & region==`i', cluster(responseid) 
		estimates store project_reg`i'
	quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & region==`i', cluster(responseid) 
		estimates store bailout_reg`i'
	coefplot (project_reg`i', label(Project Loan) mcolor(black) ciopts(lcolor(black))) ///
		(bailout_reg`i', label(Bailout Loan) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))) ///
		, baselevels drop(_cons) xline(0) legend(rows(1) position(6)) ///
		msize(small) xtitle("Estimated AMCEs", size(small)) xlabel(, labsize(small)) ylabel(, labcolor(gs5) labsize(small)) ///
		headings(1.att_lender="{bf:Lender}" ///
			1.att_purpose="{bf:Purpose}" ///
			1.att_collateral="{bf:Collateral}" ///
			1.att_condition="{bf:Conditionality}" ///
			1.att_intrate="{bf:Interest rate}", ///
			labcolor(black) labsize(small)) ///
			title(Region=`i')
		graph save Charts\FigureE2_Region`i'.gph, replace 	
		}

		
/* Figure E3. Conjoint experiment results, by country */
		
local countries="Kenya Nigeria SouthAfrica Argentina Colombia Peru Indonesia Malaysia Philippines"
foreach ctry in `countries' {
	quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & country=="`ctry'", cluster(responseid) 
		estimates store project_`ctry'
	quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & country=="`ctry'", cluster(responseid) 
		estimates store bailout_`ctry'
	coefplot (project_`ctry', label(Project Loan) mcolor(black) ciopts(lcolor(black))) ///
		(bailout_`ctry', label(Bailout Loan) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))) ///
		, baselevels drop(_cons) xline(0) legend(rows(1) position(6)) ///
		msize(small) xtitle("Estimated AMCEs", size(small)) xlabel(, labsize(small)) ylabel(, labcolor(gs5) labsize(small)) ///
		headings(1.att_lender="{bf:Lender}" ///
			1.att_purpose="{bf:Purpose}" ///
			1.att_collateral="{bf:Collateral}" ///
			1.att_condition="{bf:Conditionality}" ///
			1.att_intrate="{bf:Interest rate}", ///
			labcolor(black) labsize(small)) ///
			title(`ctry')
		graph save Charts\FigureE3_`ctry'.gph, replace 	
		}

		
/* Figure E5a. Conjoint results, conditional on whether respondents believe that lending from the Chinese government has caused past economic harm */
	
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & debt_harm_chn==0, cluster(responseid) 
	estimates store project_noharm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & debt_harm_chn==1, cluster(responseid) 
	estimates store project_harm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & debt_harm_chn==0, cluster(responseid) 
	estimates store bailout_noharm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & debt_harm_chn==1, cluster(responseid) 
	estimates store bailout_harm
	
coefplot (project_noharm, label(No Harm (China)) mcolor(black) ciopts(lcolor(black))) ///
		(project_harm, label(Past Harm (China)) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Project Loan") || ///
		(bailout_noharm, label(No Harm (China)) mcolor(black) ciopts(lcolor(black))) ///
		(bailout_harm, label(Past Harm (China)) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Bailout Loan") ||, ///
		baselevels drop(_cons) xline(0) ///
		msize(small) xtitle("Estimated AMCEs", size(small)) xlabel(, labsize(small)) ylabel(, labcolor(gs5) labsize(small)) ///
		headings(1.att_lender="{bf:Lender}" ///
			1.att_purpose="{bf:Purpose}" ///
			1.att_collateral="{bf:Collateral}" ///
			1.att_condition="{bf:Conditionality}" ///
			1.att_intrate="{bf:Interest rate}", ///
			labcolor(black) labsize(small)) ///
			legend(position(bottom))			
			graph save Charts\FigureE5a.gph, replace
			
			
/* Figure E5b. Conjoint results, conditional on whether respondents believe that lending from the US government has caused past economic harm */

quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & debt_harm_usa==0, cluster(responseid) 
	estimates store project_noharm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & debt_harm_usa==1, cluster(responseid) 
	estimates store project_harm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & debt_harm_usa==0, cluster(responseid) 
	estimates store bailout_noharm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & debt_harm_usa==1, cluster(responseid) 
	estimates store bailout_harm
	
coefplot (project_noharm, label(No Harm (US)) mcolor(black) ciopts(lcolor(black))) ///
		(project_harm, label(Past Harm (US)) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Project Loan") || ///
		(bailout_noharm, label(No Harm (US)) mcolor(black) ciopts(lcolor(black))) ///
		(bailout_harm, label(Past Harm (US)) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Bailout Loan") ||, ///
		baselevels drop(_cons) xline(0) ///
		msize(small) xtitle("Estimated AMCEs", size(small)) xlabel(, labsize(small)) ylabel(, labcolor(gs5) labsize(small)) ///
		headings(1.att_lender="{bf:Lender}" ///
			1.att_purpose="{bf:Purpose}" ///
			1.att_collateral="{bf:Collateral}" ///
			1.att_condition="{bf:Conditionality}" ///
			1.att_intrate="{bf:Interest rate}", ///
			labcolor(black) labsize(small)) ///
			legend(position(bottom))			
			graph save Charts\FigureE5b.gph, replace
			
/* Figure E5c. Conjoint results, conditional on whether respondents believe that lending from private commercial banks has caused past economic harm */

quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & debt_harm_priv==0, cluster(responseid) 
	estimates store project_noharm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & debt_harm_priv==1, cluster(responseid) 
	estimates store project_harm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & debt_harm_priv==0, cluster(responseid) 
	estimates store bailout_noharm
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & debt_harm_priv==1, cluster(responseid) 
	estimates store bailout_harm
	
coefplot (project_noharm, label(No Harm (Private)) mcolor(black) ciopts(lcolor(black))) ///
		(project_harm, label(Past Harm (Private)) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Project Loan") || ///
		(bailout_noharm, label(No Harm (Private)) mcolor(black) ciopts(lcolor(black))) ///
		(bailout_harm, label(Past Harm (Private)) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Bailout Loan") ||, ///
		baselevels drop(_cons) xline(0) ///
		msize(small) xtitle("Estimated AMCEs", size(small)) xlabel(, labsize(small)) ylabel(, labcolor(gs5) labsize(small)) ///
		headings(1.att_lender="{bf:Lender}" ///
			1.att_purpose="{bf:Purpose}" ///
			1.att_collateral="{bf:Collateral}" ///
			1.att_condition="{bf:Conditionality}" ///
			1.att_intrate="{bf:Interest rate}", ///
			labcolor(black) labsize(small)) ///
			legend(position(bottom))			
			graph save Charts\FigureE5c.gph, replace

	
/* Figure E6. Interaction of creditor and loan characteristics on foreign loan preferences, marginal means */	

use ForeignBorrowingPublicOpinion_ProjectLoan.dta, clear
keep if att_lender<3
gen lender_chn=att_lender==2
conjoint selected att_collateral att_condition att_intrate att_purpose, subgroup(lender_chn) est(mm) id(responseid) 
	matrix project_mm_intn=e(results__0)
	matrix project_mm_inty=e(results__1)
use ForeignBorrowingPublicOpinion_BailoutLoan.dta, clear
keep if att_lender<3
gen lender_chn=att_lender==2
conjoint selected att_collateral att_condition att_intrate, subgroup(lender_chn) est(mm) id(responseid) 
	matrix bailout_mm_intn=e(results__0)
	matrix bailout_mm_inty=e(results__1)

coefplot (matrix(project_mm_intn[,1]), label(World Bank/IMF) mcolor(black) ciopts(lcolor(black))) ///
		(matrix(project_mm_inty[,1]), label(Chinese government) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Project Loan") || ///
		(matrix(bailout_mm_intn[,1]), label(World Bank/IMF) mcolor(black) ciopts(lcolor(black))) ///
		(matrix(bailout_mm_inty[,1]), label(Chinese government) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Bailout Loan") ||, ///
		ci((5 6)) keep(*:) order(World_Bank IMF Chinese_government US_government Private_banks) xline(0.5, lpattern(-) lcolor(black)) ///
		coeflabels( World_Bank= "World Bank" IMF="IMF"  Chinese_government= "Chinese government"  US_government= "US government"  Private_banks= "Private banks" ///
		Nothing= "Nothing"  Land= "Land"  Resources= "Resources"  None="None"  Austerity= "Austerity"  Transparency= "Transparency"  Labor_and_materials= "Labor and materials"  ///
		_2_= "2%"  _6_= "6%"  _10_= "10%"  Highway_network= "Highway network"  _5G_network= "5G network") ///		
		eqlabels( "{bf:Collateral}" "{bf:Conditionality}" "{bf:Interest Rate}" "{bf:Purpose}", asheadings) graphregion(col(white)) scale(0.7) xtitle({bf:Estimated MMs}) ///
		legend(position(bottom))	
		graph save Charts\FigureE6.gph, replace 

		
/* Figure E7. Conjoint results, conditioned on agreement that the IMF is controlled by the US */

use ForeignBorrowingPublicOpinion_ConjointMerged.dta, clear
gen imfus=debt_imf==1
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & imfus==0, cluster(responseid) 
	estimates store bailout_imfnotus
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & imfus==1, cluster(responseid) 
	estimates store bailout_imfus
	
coefplot (bailout_imfnotus, label(IMF not controlled by US) mcolor(black) ciopts(lcolor(black))) ///
		(bailout_imfus, label(IMF controlled by US) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))) ///
		, baselevels drop(_cons) xline(0) legend(rows(1) position(6)) ///
		msize(small) xtitle("Estimated AMCEs", size(small)) xlabel(, labsize(small)) ylabel(, labcolor(gs5) labsize(small)) ///
		headings(1.att_lender="{bf:Lender}" ///
			1.att_purpose="{bf:Purpose}" ///
			1.att_collateral="{bf:Collateral}" ///
			1.att_condition="{bf:Conditionality}" ///
			1.att_intrate="{bf:Interest rate}", ///
			labcolor(black) labsize(small))
		graph save Charts\FigureE7.gph, replace 
		
		
/* Figure F3. Estimated AMCEs, conditioned on sovereignty threat perception */

use ForeignBorrowingPublicOpinion_ConjointMerged.dta, replace
gen chinasovthreat=debt_sov_lender==2
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & chinasovthreat==0, cluster(responseid) 
	estimates store project_chnsov0
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & chinasovthreat==1, cluster(responseid) 
	estimates store project_chnsov1
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & chinasovthreat==0, cluster(responseid) 
	estimates store bailout_chnsov0
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & chinasovthreat==1, cluster(responseid) 
	estimates store bailout_chnsov1
	
coefplot (project_chnsov0, label(China No Threat) mcolor(black) ciopts(lcolor(black))) ///
		(project_chnsov1, label(China Sov. Threat) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Project Loan") || ///
		(bailout_chnsov0, label(China No Threat) mcolor(black) ciopts(lcolor(black))) ///
		(bailout_chnsov1, label(China Sov. Threat) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Bailout Loan") ||, ///
		baselevels drop(_cons) xline(0) ///
		msize(small) xtitle("Estimated AMCEs", size(small)) xlabel(, labsize(small)) ylabel(, labcolor(gs5) labsize(small)) ///
		headings(1.att_lender="{bf:Lender}" ///
			1.att_purpose="{bf:Purpose}" ///
			1.att_collateral="{bf:Collateral}" ///
			1.att_condition="{bf:Conditionality}" ///
			1.att_intrate="{bf:Interest rate}", ///
			labcolor(black) labsize(small)) ///
			legend(position(bottom))			
			graph save Charts\FigureF3.gph, replace

	
/* Figure F7. Estimated AMCEs, conditioned by associating China with "debt trap diplomacy" */

gen debt_trap_chn=debt_trap_lender==2
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & debt_trap_chn==0, cluster(responseid) 
	estimates store project_notrap
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate i.att_purpose if projconj==1 & debt_trap_chn==1, cluster(responseid) 
	estimates store project_trap
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & debt_trap_chn==0, cluster(responseid) 
	estimates store bailout_notrap
quietly reg selected i.att_lender i.att_collateral i.att_condition i.att_intrate if bailconj==1 & debt_trap_chn==1, cluster(responseid) 
	estimates store bailout_trap
	
coefplot (project_notrap, label(No Debt Trap) mcolor(black) ciopts(lcolor(black))) ///
		(project_trap, label(China Debt Trap) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Project Loan") || ///
		(bailout_notrap, label(No Debt Trap) mcolor(black) ciopts(lcolor(black))) ///
		(bailout_trap, label(China Debt Trap) mcolor(gs7) msymbol(square) ciopts(lcolor(gs7))), bylabel("Bailout Loan") ||, ///
		baselevels drop(_cons) xline(0) ///
		msize(small) xtitle("Estimated AMCEs", size(small)) xlabel(, labsize(small)) ylabel(, labcolor(gs5) labsize(small)) ///
		headings(1.att_lender="{bf:Lender}" ///
			1.att_purpose="{bf:Purpose}" ///
			1.att_collateral="{bf:Collateral}" ///
			1.att_condition="{bf:Conditionality}" ///
			1.att_intrate="{bf:Interest rate}", ///
			labcolor(black) labsize(small)) ///
			legend(position(bottom))			
			graph save Charts\FigureF7.gph, replace
	